<div class="col-sm-12">
    <style>
        .pre-scrollable {
            max-height: 545px;
            overflow-y: scroll;
        }
    </style>
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="form-group">
                <div class="col-xs-12">
                    <div class="row">
                        <div class="col-xs-3">
                            <input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-model="section.start.date.label" is-open="section.start.date.opened"
                                ng-click="open($event, section.start.date)" placeholder="开始时间" ng-required="true" close-text="Close"
                                readonly/>
                        </div>
                        <div class="col-xs-3 ">
                            <input type="text" 
                                class="form-control" 
                                datepicker-popup="yyyy-MM-dd" 
                                ng-model="section.end.date.label" 
                                is-open="section.end.date.opened"
                                ng-click="open($event, section.end.date)" 
                                datepicker-options="inlineOptions"
                                placeholder="结束时间" 
                                ng-required="true" 
                                close-text="Close"
                                readonly/>
                        </div>
                        <div class="col-xs-3 ">
                            <input type="text" class="form-control" ng-keyup="myKeyup($event)" ng-model="searchform.product_name" placeholder="产品名称">
                        </div>
                        <div class="col-xs-3 ">
                            <ui-select ng-model="searchform.company_type" theme="bootstrap" ng-keyup="myKeyup($event)" ng-show="!isOnlyOneCompany">
                                <ui-select-match placeholder="统计类型">
                                    {{$select.selected.label}}
                                </ui-select-match>
                                <ui-select-choices repeat="item.value as item in companyarr | filter: $select.search">
                                    <span ng-bind-html="item.label | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>
                        </div>
                    </div>
                    <div class="row mt10 ">
                        <div class="col-xs-3 ">
                            <ui-select ng-model="searchform.count_type" theme="bootstrap" ng-keyup="myKeyup($event)">
                                <ui-select-match placeholder="统计方式">
                                    {{$select.selected.label}}
                                </ui-select-match>
                                <ui-select-choices repeat="item.value as item in count_type_arr | filter: $select.search">
                                    <span ng-bind-html="item.label | highlight: $select.search"></span>
                                </ui-select-choices>
                            </ui-select>
                        </div>

                        <div class="col-xs-3 ">
                            <input type="text" class="form-control" ng-model="selectedCompany" ng-show="isOnlyOneCompany" disabled />
                            <input type="text" class="form-control" ng-model="selectedCompany" ng-show="!isOnlyOneCompany" ng-click="openCompanyTree()"
                                readonly />
                        </div>

                        <div class="col-xs-3 pull-right">
                            <input type="button " class="btn btn-info search form-control" ng-click="orderSearch()" value="立即搜索">
                        </div>

                        <div class="col-xs-3 pull-right">
                            <input type="button " class="btn btn-info search form-control" ng-click="exportToExcel('#Excel_table')" value="导出Excel">
                            <a id="dlink" download="{{selectedCompany}}{{ExcelName}}.xls" ng-show="false"></a>
                        </div>
                    </div>
                    <div class="row mt10 ">
                        <div class="col-xs-2 text-center">支付类型:</div>
                        <div class="col-xs-10 row" style="white-space:nowrap;">
                            <span style="margin-left:10px;" ng-repeat="type in payTypeList">
                                <label class="" >
                                    {{type.name}}
                                    <input type="checkbox" ng-model="type.isCheck" />
                                </label>
                            </span>
                            <span style="margin-left:15px;">
                                <label class="" ng-click="allChange()">
                                    全选
                                    <input type="checkbox" ng-model="pay_type_all" />
                                </label>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="panel panel-default" ng-if="objs.length">
        <div class="panel-body">
            <div class="col-xs-12  pre-scrollable" ng-if="item.list.length" ng-repeat="item in objs" style "max-height:650px;">
                {{item.name}}({{item.code}})
                <table class="table table-hover table-bordered" content="text/html; charset=utf-8">
                    <thead>
                        <tr>
                            <th class="col-md-1 text-center" ng-if="!isOnlyOneCompany">机构编码</th>
                            <th class="col-md-1 text-center" ng-if="!isOnlyOneCompany">机构名称</th>
                            <th class="col-md-1 text-center">产品编码</th>
                            <th class="col-md-2 text-center">产品名称</th>
                            <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">支付方式</th>
                            <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">购买数量</th>
                            <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">使用数量</th>
                            <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">退票数量</th>
                            <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">支付金额</th>
                            <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">退款金额</th>
                            <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">实收金额</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="obj in item.list">
                            <td class="text-center" ng-if="!isOnlyOneCompany">{{obj.company_code}}</td>
                            <td class="text-center" ng-if="!isOnlyOneCompany">{{obj.company_name}}</td>
                            <td class="text-center">{{obj.sale_code}}</td>
                            <td class="text-center">{{obj.sale_name}}</td>
                            <td class="text-center">{{obj.payment_type_name}}</td>
                            <td class="text-center">{{obj.buy}}</td>
                            <td class="text-center">{{obj.used}}</td>
                            <td class="text-center">{{obj.back}}</td>
                            <td class="text-center">{{obj.total_buy}}</td>
                            <td class="text-center">{{obj.total_back}}</td>
                            <td class="text-center">{{obj.total_money}}</td>
                        </tr>
                        <tr>
                            <td class="text-center" colspan="{{isOnlyOneCompany?3:5}}">合计</td>
                            <td class="text-center">{{item.count_buy}}</td>
                            <td class="text-center">{{item.count_used}}</td>
                            <td class="text-center">{{item.count_back}}</td>
                            <td class="text-center">{{item.count_total_buy}}</td>
                            <td class="text-center">{{item.count_total_back}}</td>
                            <td class="text-center">{{item.count_total_money}}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <!--导出Excel用的表格-->
    <table ng-show="false" id="Excel_table" content="text/html; charset=utf-8">
        <thead>
            <tr>
                <th class="col-md-1 text-center" ng-if="!isOnlyOneCompany">机构编码</th>
                <th class="col-md-1 text-center" ng-if="!isOnlyOneCompany">机构名称</th>
                <th class="col-md-1 text-center">产品编码</th>
                <th class="col-md-2 text-center">产品名称</th>
                <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">支付方式</th>
                <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">购买数量</th>
                <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">使用数量</th>
                <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">退票数量</th>
                <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">支付金额</th>
                <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">退款金额</th>
                <th class="col-md-1 text-center" style="padding-left:0px;padding-right: 0px;">实收金额</th>
            </tr>
        </thead>
        <tbody ng-repeat="item in objs">
            <tr ng-repeat="obj in item.list">
                <td class="text-center" ng-if="!isOnlyOneCompany">{{obj.company_code}}</td>
                <td class="text-center" ng-if="!isOnlyOneCompany">{{obj.company_name}}</td>
                <td class="text-center">{{obj.sale_code}}</td>
                <td class="text-center">{{obj.sale_name}}</td>
                <td class="text-center">{{obj.payment_type_name}}</td>
                <td class="text-center">{{obj.buy}}</td>
                <td class="text-center">{{obj.used}}</td>
                <td class="text-center">{{obj.back}}</td>
                <td class="text-center">{{obj.total_buy}}</td>
                <td class="text-center">{{obj.total_back}}</td>
                <td class="text-center">{{obj.total_money}}</td>
            </tr>
            <tr>
                <td class="text-center" colspan="{{isOnlyOneCompany?3:5}}">合计</td>
                <td class="text-center">{{item.count_buy}}</td>
                <td class="text-center">{{item.count_used}}</td>
                <td class="text-center">{{item.count_back}}</td>
                <td class="text-center">{{item.count_total_buy}}</td>
                <td class="text-center">{{item.count_total_back}}</td>
                <td class="text-center">{{item.count_total_money}}</td>
            </tr>
        </tbody>
    </table>
    <!--导出Excel用的表格-->

</div>